home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / LROTR.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  467 b   |  19 lines

  1. /* lrotr.c function, from p.223 of turbo c bible */
  2. #include<stdio.h>
  3. #include<stdlib.h>
  4. main(int argc , char **argv)
  5. {
  6.     int bits;
  7.     unsigned long value;
  8.     char **eptr;
  9.     if (argc < 3)
  10.     {
  11.         printf("Usage: %s <hex value  (max 8 digits)>"
  12.             "<no. bits to rotate right > \n",argv[0]);
  13.         exit(0);
  14.     }
  15.     value = strtoul(argv[1], eptr, 16);
  16.     bits = atoi(argv[2]);
  17.     printf("%#8.8lx rotated right by %d bits = %#8.8lx\n",
  18.         value, bits, _lrotr(value, bits));
  19. }